package com.guo.hui.eurekaclient;

import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName HelloController
 * @Description TODO
 * @Author zhengguohui
 * @Date 2018/7/17 19:10
 */

@RestController
public class HelloController {

    private final Logger logger = Logger.getLogger(getClass());

    @Autowired
    DiscoveryClient discoveryClient;


    @RequestMapping("/hello")
    public String hello(String name) {
        logger.info("==eureka-client1==");
        String ss = "hello" + name;
        return ss;
    }

    @RequestMapping("/world")
    public String world(String name, Integer kk) {
        logger.info("==eureka-client==2");
        System.out.println(kk++);
        String ss = "hello" + name + kk;
        return ss;
    }

    @GetMapping("/dc")
    public String dc() {
        logger.info("==eureka-client3==");
        String service = "Services: " + discoveryClient.getServices();
        System.out.println(service);
        return service;
    }


}
